//
//  ReleaseViewController.swift
//  NDAi
//
//  Created by 丸子 on 2024/8/19.
//

import UIKit

class ReleaseViewController: BaseViewController {
    var type:Int = 1
    var msg:String = ""
    lazy var coverIV: UIImageView = {
       let imageView = UIImageView()
        imageView.contentMode = .scaleAspectFill
        imageView.clipsToBounds = false
        imageView.image = UIImage(named: "icon_release_Success")
        imageView.allRound(8)
        return imageView
    }()
    
    lazy var titleLb: UILabel = {
       let label = UILabel()
        label.text = "你的作品已发布成功"
        label.textColor = Theme.color.text_d1
        label.font = UIFont.pingFangSCRegular(ofSize: 14)
        label.textAlignment = .center
        return label
    }()
    
    private lazy var okBtn: UIButton = {
        let button = UIButton(type: .custom)
        button.titleForNormal = "确定"
        button.titleFont = UIFont.pingFangSCRegular(ofSize: 16)
        button.titleColorForNormal = .white
        button.allRound(27)
        button.backgroundColor = UIColor(hexString: "#25262B")
        return button
    }()
    
    
    override func viewDidLoad() {
        super.viewDidLoad()
        self.navigationItem.title = "发布结果"
        self.view.addSubviews([coverIV, titleLb, okBtn])
        self.coverIV.snp.makeConstraints { make in
            make.centerX.equalToSuperview()
            make.top.equalTo(69)
            make.width.height.equalTo(105)
        }
        
        titleLb.snp.makeConstraints { make in
            make.top.equalTo(coverIV.snp.bottom).offset(21)
            make.centerX.equalToSuperview()
            make.leading.trailing.equalToSuperview().inset(24)
        }
        
        okBtn.snp.makeConstraints { make in
            make.centerX.equalToSuperview()
            make.top.equalTo(titleLb.snp.bottom).offset(86)
            make.width.equalTo(200)
            make.height.equalTo(54)
        }
        
        okBtn.setClosureTouchUpInside_k { [weak self] in
            self?.navigationController?.popViewController(animated: true)
        }
        self.setState()
    }
    
    func setState(){
        if type == 1 {
            coverIV.image = UIImage(named: "icon_release_Success")
            titleLb.text = "您的作品已发布成功！"
        }else if type == 2{
            coverIV.image = UIImage(named: "icon_release_error")
            titleLb.text = "抱歉，您的作品发布失败"
        }
    }
    
}
